package cn.lin.task.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.lin.task.dao.IUserDao;
import cn.lin.task.model.Pager;
import cn.lin.task.model.User;

@Service("userService")
public class UserService implements IUserService {
	
	
	private IUserDao userDao;
	
	public IUserDao getUserDao() {
		return userDao;
	}

	@Resource
	public void setUserDao(IUserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public void add(User user) {
		// TODO Auto-generated method stub
		userDao.add(user);
	}

	@Override
	public void delete(int id) {
		// TODO Auto-generated method stub
		userDao.delete(id);
	}

	@Override
	public void update(User user) {
		// TODO Auto-generated method stub
		userDao.update(user);
	}

	@Override
	public User load(int id) {
		// TODO Auto-generated method stub
		return userDao.load(id);
	}

	@Override
	public User load(String stuID) {
		// TODO Auto-generated method stub
		return userDao.load(stuID);
	}

	@Override
	public Pager<User> find() {
		// TODO Auto-generated method stub
		String hql="from User user";
		return userDao.find(hql);
	}

	@Override
	public List<User> listAllUser() {
		// TODO Auto-generated method stub
		String hql="from User user";
		return userDao.list(hql);	
	}

	@Override
	public Pager<User> find(String hql) {
		// TODO Auto-generated method stub
		return userDao.find(hql);
	}

	@Override
	public List<User> list(String hql) {
		// TODO Auto-generated method stub
		return userDao.list(hql);
	}

}
